package com.wedimob.html;

import org.apache.http.Header;
import org.apache.http.StatusLine;

public class HTMLPage {
    String url;
    Header header[];
    String body;
    StatusLine status;

    public HTMLPage(String url, StatusLine status, Header[] header, String body) {
        super();
        this.url = url;
        this.status = status;
        this.header = header;
        this.body = body;
    }

    public String getUrl() {
        return url;
    }

    public Header[] getHeader() {
        return header;
    }

    public String getBody() {
        return body;
    }

    public StatusLine getStatus() {
        return status;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("status[");
        sb.append(status.getStatusCode());
        sb.append("]");
        sb.append(", header[");
        for (int i = 0; i < header.length; i++) {
            if (i > 0)
                sb.append(", ");
            sb.append(header[i].getName());
            sb.append("=");
            sb.append(header[i].getValue());
        }
        sb.append(", body[");
        sb.append(body);
        sb.append("]");
        return sb.toString();
    }
}
